package com.itheima.service.impl;

import com.itheima.dao.AccountDao;
import com.itheima.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class AccountServiceImpl implements AccountService {

    @Autowired
    private AccountDao accountDao;

   /* @Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.REQUIRED,readOnly = false,timeout = -1)*/
    @Transactional(readOnly = true)
    @Override
    public void transfer(String outUser, String inUser, Double money) {
        //转出
        accountDao.outAccount(outUser, money);
        int i=1/0;
        //转入
        accountDao.inAccount(inUser, money);
    }
}
